package com.itheima.service;

import com.itheima.mapper.UserMapper;
import com.itheima.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author huangbin
 * @date 2022/6/6 15:01
 */
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 查询所有账号密码
     *
     * @return 所有账号密码
     */
    public List<User> selectAll() {
        return userMapper.selectAll();
    }

    /**
     * 查询用户是否存在
     *
     * @param username 用户名
     * @param password 密码
     * @return 查询条数
     */
    public Integer selectUser(String username, String password) {
        System.out.println(username);
        return userMapper.selectUser(username, password);
    }

    public Integer add(User user) {
        return userMapper.add(user);
    }

}
